using ASP;
using HoWave.Common;
using HoWave.Web;
using HoWave.Web.Admin;
using System;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class HL_Admin_Admin_ShopBuyMoney : Admin, IRequiresSessionState
{
	protected DropDownList DropStatus;
	protected DropDownList DropPayType;
	protected TextBox begindate;
	protected TextBox EndDate;
	protected TextBox TextBox1;
	protected DropDownList DropDownList1;
	protected GridView GridView1;
	protected Label msg;
	protected Label PagePanel;
	protected Button ButDel;
	protected Button ButSetRablishi;
	protected Button ButPayed;
	private Shop_BuyMoney _buymoney;
	private Shop_PayType _paytype = null;
	private string m_status = "";
	private string m_paytype = "";
	private string m_bt = "";
	private string m_et = "";
	private bool m_tag = false;
	private string wherestr = "";
	private string linkhead = "";
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected Shop_BuyMoney m_buymoney
	{
		get
		{
			Shop_BuyMoney buymoney;
			if (this._buymoney == null)
			{
				this._buymoney = new Shop_BuyMoney(this.conn);
				buymoney = this._buymoney;
			}
			else
			{
				buymoney = this._buymoney;
			}
			return buymoney;
		}
	}
	protected Shop_PayType m_PayType
	{
		get
		{
			Shop_PayType paytype;
			if (this._paytype == null)
			{
				this._paytype = new Shop_PayType(this.conn);
				paytype = this._paytype;
			}
			else
			{
				paytype = this._paytype;
			}
			return paytype;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.admin.CheckAdminPower(27))
		{
			base.WriteLog("View", Language.GetAdminMsg("Log/Access", "0"), "Order");
			base.WriteRightErrMsg();
		}
		if (!base.IsPostBack)
		{
			this.begindate.Text = DateTime.Now.AddDays(-3.0).ToShortDateString();
			this.EndDate.Text = DateTime.Now.ToShortDateString();
			this.BindList();
		}
		this.begindate.Attributes.Add("onClick", string.Concat(new string[]
		{
			"show_cele_date(",
			this.begindate.UniqueID,
			",'','',",
			this.begindate.UniqueID,
			");"
		}));
		this.EndDate.Attributes.Add("onClick", string.Concat(new string[]
		{
			"show_cele_date(",
			this.EndDate.UniqueID,
			",'','',",
			this.EndDate.UniqueID,
			");"
		}));
	}
	protected void BindList()
	{
		int num = Fetch.GetID("page");
		if (num <= 0)
		{
			num = 1;
		}
		this.QuestString();
		int maxperpage = 15;
		if (this.GridView1.PageSize > 0)
		{
			maxperpage = Convert.ToInt32(this.GridView1.PageSize);
		}
		this.GridView1.DataSource = this.m_buymoney.GetBuyMoneys(num, maxperpage, this.wherestr, "");
		this.GridView1.DataBind();
		this.PagePanel.Text = this.m_buymoney.GetPagePanel(this.linkhead);
	}
	protected void QuestString()
	{
		this.m_status = Fetch.Get("status");
		if (this.m_status != string.Empty && this.m_tag)
		{
			this.DropStatus.SelectedValue = this.m_status;
		}
		else
		{
			this.m_status = this.DropStatus.SelectedValue;
		}
		if (this.m_status != "-1" && this.m_status != string.Empty)
		{
			int num = int.Parse(this.m_status);
			this.wherestr = this.wherestr + "and status=" + num.ToString() + " ";
			this.linkhead = this.linkhead + "&status=" + num.ToString();
		}
		this.m_paytype = Fetch.Get("type");
		if (this.m_paytype != string.Empty && this.m_tag)
		{
			this.DropPayType.SelectedValue = this.m_paytype;
		}
		else
		{
			this.m_paytype = this.DropPayType.SelectedValue;
		}
		if (this.m_paytype != string.Empty)
		{
			int num2 = int.Parse(this.m_paytype);
			this.wherestr = this.wherestr + "and paytype=" + num2.ToString() + " ";
			this.linkhead = this.linkhead + "&type=" + num2.ToString();
		}
		this.m_bt = Fetch.Get("bt");
		if (this.m_bt != string.Empty && this.m_tag)
		{
			this.begindate.Text = this.m_bt;
		}
		else
		{
			this.m_bt = this.begindate.Text;
		}
		if (this.m_bt != string.Empty)
		{
			DateTime dateTime = Convert.ToDateTime(this.m_bt);
			this.wherestr = this.wherestr + "and dateDiff(d,createdate,'" + dateTime.ToString() + "')<=0 ";
			this.linkhead = this.linkhead + "&bt=" + dateTime.ToString();
		}
		this.m_et = Fetch.Get("et");
		if (this.m_et != string.Empty && this.m_tag)
		{
			this.EndDate.Text = this.m_et;
		}
		else
		{
			this.m_et = this.EndDate.Text;
		}
		if (this.m_et != string.Empty)
		{
			DateTime dateTime2 = Convert.ToDateTime(this.m_bt);
			if (this.m_bt != "")
			{
				if (Convert.ToDateTime(this.m_et) < Convert.ToDateTime(this.m_bt))
				{
					this.WriteErrMsg("", Language.GetAdminMsg("Common/DateTimeErr"), "");
				}
			}
			this.wherestr = this.wherestr + "and dateDiff(d,createdate,'" + dateTime2.ToString() + "')>=0 ";
			this.linkhead = this.linkhead + "&et=" + dateTime2.ToString();
		}
		if (this.wherestr != "")
		{
			this.wherestr = "and" + this.wherestr;
			this.wherestr = this.wherestr.Replace("andand", "where");
		}
	}
	protected void ButtonOnCommon(object sender, CommandEventArgs e)
	{
		string text = this.CheckNumList(base.Request["chk_select"]);
		if (text != "")
		{
			string commandName = e.CommandName;
			if (commandName != null)
			{
				if (!(commandName == "del"))
				{
					if (commandName == "rab")
					{
						if (!base.admin.CheckAdminPower(27))
						{
							base.WriteRightErrMsg();
						}
						else
						{
							this.m_buymoney.UpdateStatus(4, text);
						}
					}
				}
				else
				{
					if (!base.admin.CheckAdminPower(27))
					{
						base.WriteRightErrMsg();
					}
					else
					{
						this.m_buymoney.DeleteBuyMoney(text);
					}
				}
			}
			this.BindList();
		}
	}
	protected void DropStatus_OnChange(object sender, EventArgs e)
	{
		this.m_tag = false;
		this.BindList();
	}
	protected void DropPayType_OnChange(object sender, EventArgs e)
	{
		this.m_tag = false;
		this.BindList();
	}
	protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
	{
		if (e.Row.RowType == DataControlRowType.DataRow)
		{
			e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#E7EDFE'");
			e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
		}
	}
	protected void GridView1_DataBound(object sender, EventArgs e)
	{
		foreach (GridViewRow gridViewRow in this.GridView1.Rows)
		{
			string text = gridViewRow.Cells[9].Text.Trim();
			if (text == null)
			{
				goto IL_FC;
			}
			if (!(text == "1"))
			{
				if (!(text == "2"))
				{
					if (!(text == "3"))
					{
						if (!(text == "4"))
						{
							goto IL_FC;
						}
						gridViewRow.Cells[9].Text = "作废";
					}
					else
					{
						gridViewRow.Cells[9].Text = "完成";
					}
				}
				else
				{
					gridViewRow.Cells[9].Text = "预付订金";
				}
			}
			else
			{
				gridViewRow.Cells[9].Text = "提交";
			}
			IL_119:
			if (gridViewRow.Cells[3].Text == "")
			{
				gridViewRow.Cells[3].Text = "充值卡预付";
			}
			continue;
			IL_FC:
			gridViewRow.Cells[9].Text = "未知状态";
			goto IL_119;
		}
	}
	protected void ButPayed_Click(object sender, EventArgs e)
	{
	}
}
